package com.example.commonlib.commonutil;

import com.example.commonlib.constants.Constants;

import java.io.File;

/**
 * Created by aiyou on 2017/4/19.
 */

public class ACacheManager {

    private static ACacheManager instance;
    private ACache aCache;
    private File acacheFile;


    public static ACacheManager getInstance(){
        if (instance == null)
            instance = new ACacheManager();
        return instance;
    }



    private ACacheManager() {

        initCache();

    }

    public  void initCache(){

        if (aCache != null)
            return;

        acacheFile = new File(Constants.ROOT + "Acache/");

        if (!acacheFile.exists()){
            acacheFile.mkdirs();
        }

        aCache = ACache.get(acacheFile);

    }


    public ACache getaCache() {

        if(!acacheFile.exists()){
            acacheFile.mkdirs();
        }

        return aCache;
    }

}
